<template>
  <div class="table">
    <!--表11____县生产信息调查统计表T_MulProdInfoChart-->
    <div class="divSearch">
      <Row>
        <Col span="24" class="col-margin"> 填报年度：
        <Select v-model="searchModel.FillInYear" placeholder="全部" style="width: 100px" @on-change="GetData()">
            <Option value="">全部</Option>
            <Option :value="item.DictText" v-for="item in CreateYearList" :key="item.DictValue">{{item.DictText}}</Option>
        </Select>
        <Button icon="ios-search" type="ghost" @click="GetData()" class="ButtonStyle">
            查询
        </Button>
        <Button icon="ios-download" type="primary" @click="ExcelDown()" class="searchButton" style="float:right;width: 100px;">数据导出</Button>
        <Upload :on-success="handleSuccess" :action="GetPostUrl()" style="float:right;width: 100px;" v-show="dataModel.Status <3">
          <Button type="primary" icon="ios-cloud-upload-outline" class="searchButton">数据导入</Button>
        </Upload>
        <Button icon="ios-cloud-download" type="primary" @click="TmpDown()" class="searchButton" style="width: 100px;">模板下载</Button>
        <!-- <label style="float:right;padding: 6px;font-size:16px;">当前状态:
          <span v-if="dataModel.Status==0" class="Error"></span> 
          <span v-else-if="dataModel.Status==1" class="NoReport">未填写</span>
          <span v-else-if="dataModel.Status==2" class="AlreadyReport">已填写</span>
          <span v-else-if="dataModel.Status==3" class="UpReport">已上报</span>
          <span v-else-if="dataModel.Status==4" class="Success">审核通过</span>               
      </label> -->
        </Col>
      </Row>
    </div>
    <Row>
      <Col span="24">
      <Form ref="dataModel" :model="dataModel" :rules="ruleModel" style="height: 550px;overflow: auto;">
        <table class="reptable2">
          <caption style="font-size: 20px;font-weight: bold;">
              <label style="float:left">{{searchModel.FillInYear}}表7县蚕桑生产信息调查表</label>
              <label style="float:right">当前状态:
                <!-- <span v-if="dataModel.Status==0" class="Error">重新填写</span>  -->
                <Poptip trigger="hover" placement="left-start" v-model="visible" :content="ReportOpinion" v-if="dataModel.Status==0">
                  <span  class="Error">重新填写</span> 
                </Poptip>
                <span v-else-if="dataModel.Status==1" class="NoReport">未填写</span>
                <span v-else-if="dataModel.Status==2" class="AlreadyReport">已填写</span>
                <span v-else-if="dataModel.Status==3" class="UpReport">已上报</span>
                <span v-else-if="dataModel.Status==4" class="Success">审核通过</span>   
                <span v-else class="NoReport">无需填报</span>                
              </label><br/>
          </caption>
          <tr style="text-align:left;">
            <th colspan="4">一、乡镇信息调查</th>
          </tr>
          <tr>
            <td>万亩以上乡（镇）数（个）</td>
            <td>
              <Form-item prop="NumTownship">
                <Input v-model="dataModel.NumTownship"></Input>
              </Form-item>
              </Form-item>
            </td>
            <td>分别是</td>
            <td>
              <Form-item prop="NumTownshipName">
                <Input v-model="dataModel.NumTownshipName"></Input>
              </Form-item>
            </td>
          </tr>
          <tr>
            <td>千亩以上村（委会）（个）</td>
            <td>
              <Form-item prop="NumVillage">
                <Input v-model="dataModel.NumVillage"></Input>
              </Form-item>
            </td>
            <td>分别是</td>
            <td>
              <Input v-model="dataModel.NumVillageName"></Input>
            </td>
          </tr>
          <tr>
            <td>养蚕户（户）</td>
            <td colspan="3">
              <Form-item prop="MulHouseholds">
                <Input v-model="dataModel.MulHouseholds"></Input>
              </Form-item>
            </td>
          </tr>
          <tr>
            <td>全年养蚕量 (1)＜3张（户）</td>
            <td>
              <Form-item prop="AnnualSilkwormOne">
                <Input v-model="dataModel.AnnualSilkwormOne"></Input>
              </Form-item>
            </td>
            <td>(2)≤5张（户）</td>
            <td>
              <Form-item prop="AnnualSilkwormTwo">
                <Input v-model="dataModel.AnnualSilkwormTwo"></Input>
              </Form-item>
            </td>
          </tr>
          <tr>
            <td>(3)≤10张（户）</td>
            <td>
              <Form-item prop="AnnualSilkwormThree">
                <Input v-model="dataModel.AnnualSilkwormThree"></Input>
              </Form-item>
            </td>
            <td>(4)＞10张（户）</td>
            <td>
              <Form-item prop="AnnualSilkwormFour">
                <Input v-model="dataModel.AnnualSilkwormFour"></Input>
              </Form-item>
            </td>
          </tr>
          <tr style="text-align:left;">
            <th colspan="4">二、技术人员信息调查</th>
          </tr>
          <tr>
            <td>技术人员总数（人）</td>
            <td>
              <Form-item prop="TecPersonTotalNum">
                <Input v-model="dataModel.TecPersonTotalNum"></Input>
              </Form-item>
            </td>
            <td>其中：在职在编</td>
            <td>
              <Form-item prop="TecPersonAllInNum">
                <Input v-model="dataModel.TecPersonAllInNum"></Input>
              </Form-item>
            </td>
          </tr>
          <tr>
            <td>(1) 按性别分:男</td>
            <td>
              <Form-item prop="ManNum">
                <Input v-model="dataModel.ManNum"></Input>
              </Form-item>
            </td>
            <td>女</td>
            <td>
              <Form-item prop="WomanNum">
                <Input v-model="dataModel.WomanNum"></Input>
              </Form-item>
            </td>
          </tr>
          <tr>
            <td>(2)按年龄分:≤30岁</td>
            <td>
              <Form-item prop="AgeOne">
                <Input v-model="dataModel.AgeOne"></Input>
              </Form-item>
            </td>
            <td>30-40岁</td>
            <td>
              <Form-item prop="AgeTwo">
                <Input v-model="dataModel.AgeTwo"></Input>
              </Form-item>
            </td>
          </tr>
          <tr>
            <td>40-50岁</td>
            <td>
              <Form-item prop="AgeThree">
                <Input v-model="dataModel.AgeThree"></Input>
              </Form-item>
            </td>
            <td>50岁以上</td>
            <td>
              <Form-item prop="AgeFour">
                <Input v-model="dataModel.AgeFour"></Input>
              </Form-item>
            </td>
          </tr>
          <tr>
            <td>(3)按学历层次分:硕士及以上</td>
            <td>
              <Form-item prop="EduLevelOne">
                <Input v-model="dataModel.EduLevelOne"></Input>
              </Form-item>
            </td>
            <td>本科</td>
            <td>
              <Form-item prop="EduLeveTwo">
                <Input v-model="dataModel.EduLeveTwo"></Input>
              </Form-item>
            </td>
          </tr>
          <tr>
            <td>大专</td>
            <td>
              <Form-item prop="EduLevelThree">
                <Input v-model="dataModel.EduLevelThree"></Input>
              </Form-item>
            </td>
            <td>中专（技校）</td>
            <td>
              <Form-item prop="EduLevelFour">
                <Input v-model="dataModel.EduLevelFour"></Input>
              </Form-item>
            </td>
          </tr>
          <tr>
            <td>(4)职称情况:正高</td>
            <td>
              <Form-item prop="TitleOne">
                <Input v-model="dataModel.TitleOne"></Input>
              </Form-item>
            </td>
            <td>副高</td>
            <td>
              <Form-item prop="TitleTwo">
                <Input v-model="dataModel.TitleTwo"></Input>
              </Form-item>
            </td>
          </tr>
          <tr>
            <td>中职</td>
            <td>
              <Form-item prop="TitleThree">
                <Input v-model="dataModel.TitleThree"></Input>
              </Form-item>
            </td>
            <td>初职</td>
            <td>
              <Form-item prop="TitleFour">
                <Input v-model="dataModel.TitleFour"></Input>
              </Form-item>
            </td>
          </tr>
          <tr style="text-align:left;">
            <th colspan="4">三、蚕室、蚕具调查</th>
          </tr>
          <tr>
            <td>1.蚕种催青室间数（间）</td>
            <td>
              <Form-item prop="IncuRoomNum">
                <Input v-model="dataModel.IncuRoomNum"></Input>
              </Form-item>
            </td>
            <td>面积（m2）</td>
            <td>
              <Form-item prop="IncuRoomArea">
                <Input v-model="dataModel.IncuRoomArea"></Input>
              </Form-item>
            </td>
          </tr>
          <tr>
            <td>季催青能力（张）</td>
            <td>
              <Form-item prop="JiCuiqingPower">
                <Input v-model="dataModel.JiCuiqingPower"></Input>
              </Form-item>
            </td>
            <td>年催青（张）</td>
            <td>
              <Form-item prop="YearsOfIncu">
                <Input v-model="dataModel.YearsOfIncu"></Input>
              </Form-item>
            </td>
          </tr>
          <tr>
            <td>2.小蚕共育点（个）</td>
            <td>
              <Form-item prop="SilkwormSpots">
                <Input v-model="dataModel.SilkwormSpots"></Input>
              </Form-item>
            </td>
            <td>面积（m2）</td>
            <td>
              <Form-item prop="SilkwormArea">
                <Input v-model="dataModel.SilkwormArea"></Input>
              </Form-item>
            </td>
          </tr>
          <tr>
            <td>季共育能力（张）</td>
            <td>
              <Form-item prop="QuaternaryFertility">
                <Input v-model="dataModel.QuaternaryFertility"></Input>
              </Form-item>
            </td>
            <td>年共育量（张）</td>
            <td>
              <Form-item prop="AnnualTotalFertility">
                <Input v-model="dataModel.AnnualTotalFertility"></Input>
              </Form-item>
            </td>
          </tr>
          <tr>
            <td>3.大蚕室间数（间）</td>
            <td>
              <Form-item prop="LargeCocoonNum">
                <Input v-model="dataModel.LargeCocoonNum"></Input>
              </Form-item>
            </td>
            <td>面积（m2）</td>
            <td>
              <Form-item prop="LargeCocoonArea">
                <Input v-model="dataModel.LargeCocoonArea"></Input>
              </Form-item>
            </td>
          </tr>
          <tr>
            <td>省力化蚕台（套）</td>
            <td>
              <Form-item prop="LaborSavingRearTable">
                <Input v-model="dataModel.LaborSavingRearTable"></Input>
              </Form-item>
            </td>
            <td>方格簇（张）</td>
            <td>
              <Form-item prop="GridCluster">
                <Input v-model="dataModel.GridCluster"></Input>
              </Form-item>
            </td>
          </tr>
          <tr>
            <td>4.蚕茧收烘站（个）</td>
            <td>
              <Form-item prop="CocoonStation">
                <Input v-model="dataModel.CocoonStation"></Input>
              </Form-item>
            </td>
            <td>面积（m2）</td>
            <td>
              <Form-item prop="CocoonStationArea">
                <Input v-model="dataModel.CocoonStationArea"></Input>
              </Form-item>
            </td>
          </tr>
          <tr>
            <td>季收烘能力（吨）</td>
            <td>
              <Form-item prop="SeasonalDryCapacity">
                <Input v-model="dataModel.SeasonalDryCapacity"></Input>
              </Form-item>
            </td>
            <td>循环烘茧机（套）</td>
            <td>
              <Form-item prop="CircularDryMachine">
                <Input v-model="dataModel.CircularDryMachine"></Input>
              </Form-item>
            </td>
          </tr>
          <!-- <tr style="text-align:left;">
            <th colspan="4">四、相关企业调查</th>
          </tr>
          <tr>
            <td>(1)缫丝企业（个）</td>
            <td colspan="3">
              <Input v-model="dataModel.ReelingEnterprise"></Input>
            </td>
          </tr>
          <tr>
            <td>其中：缫丝能力≤5组</td>
            <td>
              <Input v-model="dataModel.ReelingCapacityOne"></Input>
            </td>
            <td>≤10组</td>
            <td>
              <Input v-model="dataModel.ReelingCapacityTwo"></Input>
            </td>
          </tr>
          <tr>
            <td>≤15组</td>
            <td>
              <Input v-model="dataModel.ReelingCapacityThree"></Input>
            </td>
            <td>＞15组</td>
            <td>
              <Input v-model="dataModel.ReelingCapacityFour"></Input>
            </td>
          </tr>
          <tr>
            <td>(2)蚕种场（个）</td>
            <td>
              <Input v-model="dataModel.SilkwormField"></Input>
            </td>
            <td>生产能力（万张）</td>
            <td>
              <Input v-model="dataModel.ThroughPut"></Input>
            </td>
          </tr>
          <tr>
            <td>(3)蚕丝被加工企业（个）</td>
            <td>
              <Input v-model="dataModel.SilkEnterprise"></Input>
            </td>
            <td>年加工蚕丝被（吨）</td>
            <td>
              <Input v-model="dataModel.ProcessedSilkQuilt"></Input>
            </td>
          </tr>
          <tr>
            <td>(4)其它</td>
            <td>
              <Input v-model="dataModel.Other"></Input>
            </td>
            <td>生产能力（单位：）</td>
            <td>
              <Input v-model="dataModel.OtherThroughPut"></Input>
            </td>
          </tr> -->
        </table>
      </Form>
      <div class="divButton">
        <Button type="primary" @click="save('dataModel')" :disabled="dataModel.Status < 3 && this.BtnSaveStatus ? false:true">保存</Button>
        <Button type="primary" @click="DataUp()" :disabled="dataModel.Status == 2 ? false:true">上报</Button>
      </div>
      <Alert banner type="error">
        <p style="color:red;">填报说明:</p>
        <!-- <p>1.“其它”为表格中没有统计的相关蚕桑制品的生产的企业。</p> -->
        <p>1.此表不需要每年都填报，统计信息有变动时重新填报，系统统计按每个县最后一次填报统计。</p>
        <p style="color:red;font-size: 16px;padding-top: 10px;">特别注意：若指标项没有数据，请直接填“0”</p>
        <span slot="desc"></span>
      </Alert>
      </Col>
    </Row>
  </div>
  </template>
  
  <script>
    export default {
      data() {
        //整数或保留一位小数
        const validateData = (rule, value, callback) => {
            var reg = /\S/;
            var temp = /^[0-9]\d*(\.\d+)?$/;//数字验证
            var p=/^[0-9]+([.]{1}[0-9]{1})?$/;//匹配整数或带一个小数
            if (reg.test(value)) {
              if (temp.test(value) == false) 
              {
                callback(new Error("必须是大于等于0的数字"));
              }
              else {
                if(p.test(value)==false)
                {
                  callback(new Error("只能保留一位小数"));
                }
                else{
                  callback();
                }
              }
            } 
            else {
              callback(new Error("不能为空"));
            }
          };
        ///验证整数
        const validateInt = (rule, value, callback) => {
          var reg = /\S/;
          var temp = /^[0-9]\d*(\.\d+)?$/;//数字验证
          var p=/^[0-9]+([.]{1}[0-9]{0})?$/;//匹配整数或带一个小数
          if (reg.test(value)) {
            if (temp.test(value) == false) 
            {
              callback(new Error("必须是大于等于0的数字"));
            }
            else {
              if(p.test(value)==false)
              {
                callback(new Error("只能是整数"));
              }
              else{
                callback();
              }
            }
          } 
          else {
            callback(new Error("不能为空"));
          }
        };
        const validateSexs = (rule, value, callback) => {
          var temp = /^[0-9]\d*(\.\d+)?$/;
          if (value != null && value != "") {
            if (temp.test(value) == false) {
              callback(new Error('必须是大于0的数字'));
            } else if(this.dataModel.ManNum+this.dataModel.WomanNum!=this.dataModel.TecPersonTotalNum){
               callback(new Error('男+女的人数应等于技术人员总数!'));
            }else{
              callback();
            }
          } else {
            callback();
          }
        };
        return {
          ReportOpinion:'',
          visible:true,
          datas: {}, //table数据对象
          CreateYearList: this.GetGroupDict("ReportYear"), //上报年份
          CurrentYear: this.GetCurrentYear(),//当前年度
          selectTabName: '',
          BtnSaveStatus: false,//保存按钮开关
          //查询模型：根据需求删除不不要查询条件
          searchModel: {
            ReportCode: 'MulProdInfoChart',
            FillInYear: '',
            TimesType: '',
            AreaCode: this.GetlocaStorage("CSuserinfo").AreaCode,
          },
          dataModel: { //编辑模型
            Id: 0,
            ReportId: '',
            NumTownship: '',
            NumTownshipName: '',
            NumVillage: '',
            NumVillageName: '',
            MulHouseholds: '',
            AnnualSilkwormOne: '',
            AnnualSilkwormTwo: '',
            AnnualSilkwormThree: '',
            AnnualSilkwormFour: '',
            TecPersonTotalNum: '',
            TecPersonAllInNum: '',
            ManNum: '',
            WomanNum: '',
            AgeOne: '',
            AgeTwo: '',
            AgeThree: '',
            AgeFour: '',
            EduLevelOne: '',
            EduLevelTwo: '',
            EduLevelThree: '',
            EduLevelFour: '',
            TitleOne: '',
            TitleTwo: '',
            TitleThree: '',
            TitleFour: '',
            IncuRoomNum: '',
            IncuRoomArea: '',
            JiCuiqingPower: '',
            YearsOfIncu: '',
            SilkwormSpots: '',
            SilkwormArea: '',
            QuaternaryFertility: '',
            AnnualTotalFertility: '',
            LargeCocoonNum: '',
            LargeCocoonArea: '',
            LaborSavingRearTable: '',
            GridCluster: '',
            CocoonStation: '',
            CocoonStationArea: '',
            SeasonalDryCapacity: '',
            CircularDryMachine: '',
            // ReelingEnterprise: '',
            // ReelingCapacityOne: '',
            // ReelingCapacityTwo: '',
            // ReelingCapacityThree: '',
            // ReelingCapacityFour: '',
            // SilkwormField: '',
            // ThroughPut: '',
            // SilkEnterprise: '',
            // ProcessedSilkQuilt: '',
            // Other: '',
            // OtherThroughPut: ''
          },
          ruleModel:{
                NumTownship:[{validator: validateInt, trigger: 'blur'}],
                NumVillage:[{validator: validateInt, trigger: 'blur'}],
                MulHouseholds:[{validator: validateInt, trigger: 'blur'}],
                AnnualSilkwormOne:[{validator: validateInt, trigger: 'blur'}],
                AnnualSilkwormTwo:[{validator: validateInt, trigger: 'blur'}],
                AnnualSilkwormThree:[{validator: validateInt, trigger: 'blur'}],
                AnnualSilkwormFour:[{validator: validateInt, trigger: 'blur'}],
                TecPersonTotalNum:[{validator: validateInt, trigger: 'blur'}],
                TecPersonAllInNum:[{validator: validateInt, trigger: 'blur'}],
                ManNum:[{validator: validateInt, trigger: 'blur'}],
                WomanNum:[{validator: validateInt, trigger: 'blur'}],
                AgeOne:[{validator: validateInt, trigger: 'blur'}],
                AgeTwo:[{validator: validateInt, trigger: 'blur'}],
                AgeThree:[{validator: validateInt, trigger: 'blur'}],
                AgeFour:[{validator: validateInt, trigger: 'blur'}],
                EduLevelOne:[{validator: validateInt, trigger: 'blur'}],
                EduLevelTwo:[{validator: validateInt, trigger: 'blur'}],
                EduLevelThree:[{validator: validateInt, trigger: 'blur'}],
                EduLevelFour:[{validator: validateInt, trigger: 'blur'}],
                TitleOne:[{validator: validateInt, trigger: 'blur'}],
                TitleTwo:[{validator: validateInt, trigger: 'blur'}],
                TitleThree:[{validator: validateInt, trigger: 'blur'}],
                TitleFour:[{validator: validateInt, trigger: 'blur'}],
                IncuRoomNum:[{validator: validateInt, trigger: 'blur'}],
                IncuRoomArea:[{validator: validateData, trigger: 'blur'}],
                JiCuiqingPower:[{validator: validateInt, trigger: 'blur'}],
                YearsOfIncu:[{validator: validateInt, trigger: 'blur'}],
                SilkwormSpots:[{validator: validateInt, trigger: 'blur'}],
                SilkwormArea:[{validator: validateData, trigger: 'blur'}],
                QuaternaryFertility:[{validator: validateInt, trigger: 'blur'}],
                AnnualTotalFertility:[{validator: validateInt, trigger: 'blur'}],
                LargeCocoonNum:[{validator: validateInt, trigger: 'blur'}],
                LargeCocoonArea:[{validator: validateData, trigger: 'blur'}],
                LaborSavingRearTable:[{validator: validateInt, trigger: 'blur'}],
                GridCluster:[{validator: validateInt, trigger: 'blur'}],
                CocoonStation:[{validator: validateInt, trigger: 'blur'}],
                CocoonStationArea:[{validator: validateData, trigger: 'blur'}],
                SeasonalDryCapacity:[{validator: validateData, trigger: 'blur'}],
                CircularDryMachine:[{validator: validateInt, trigger: 'blur'}],
                // ReelingEnterprise:[{validator: validateData, trigger: 'blur'}],
                // ReelingCapacityOne:[{validator: validateData, trigger: 'blur'}],
                // ReelingCapacityTwo:[{validator: validateData, trigger: 'blur'}],
                // ReelingCapacityThree:[{validator: validateData, trigger: 'blur'}],
                // ReelingCapacityFour:[{validator: validateData, trigger: 'blur'}],
                // SilkwormField:[{validator: validateData, trigger: 'blur'}],
                // ThroughPut:[{validator: validateData, trigger: 'blur'}],
                // SilkEnterprise:[{validator: validateData, trigger: 'blur'}],
                // ProcessedSilkQuilt:[{validator: validateData, trigger: 'blur'}]
            },
          clientHeight: window.innerHeight - 260, //表格默认高度
        }
      },
      mounted() {
        //table高度计算方法
        const that = this;
        window.onresize = () => {
          return (() => {
            that.clientHeight = window.innerHeight - 260;
          })()
        };
      },
      methods: {
          //获取今往年数据
        GetData: function () {
            var self = this;
            var model = new Object();
            model.ReportCode = self.searchModel.ReportCode;
            if (self.searchModel.FillInYear != null && self.searchModel.FillInYear != '') {
                model.FillInYear = self.searchModel.FillInYear;
            } else {
                model.FillInYear = self.CurrentYear + '年';//填报年度-----数据字典值
                self.searchModel.FillInYear = self.CurrentYear + '年';
            }
            model.AreaCode = self.searchModel.AreaCode;
            self.dataModel={};//清空当前数据            
            self.$http.post("Report/PostData", model).then( //获取数据编辑项的值
                function (res) {
                    self.ReportOpinion=res.data.Opinion;
                    if (res.data.list.status == 2 || res.data.list.status == 1) {
                        self.dataModel = res.data.list.model;
                        self.dataModel.NumTownship = self.dataModel.NumTownship == null ? '' : self.$options.filters.integer(self.dataModel.NumTownship);
                        self.dataModel.NumVillage =self.dataModel.NumVillage == null ? '' : self.$options.filters.integer(self.dataModel.NumVillage);
                        self.dataModel.MulHouseholds = self.dataModel.MulHouseholds == null ? '' :self.$options.filters.integer(self.dataModel.MulHouseholds);
                        self.dataModel.AnnualSilkwormOne = self.dataModel.AnnualSilkwormOne == null ? '' :self.$options.filters.integer(self.dataModel.AnnualSilkwormOne);
                        self.dataModel.AnnualSilkwormTwo = self.dataModel.AnnualSilkwormTwo == null ? '' :self.$options.filters.integer(self.dataModel.AnnualSilkwormTwo);
                        self.dataModel.AnnualSilkwormThree = self.dataModel.AnnualSilkwormThree == null ? '' :self.$options.filters.integer(self.dataModel.AnnualSilkwormThree);
                        self.dataModel.AnnualSilkwormFour = self.dataModel.AnnualSilkwormFour == null ? '' :self.$options.filters.integer(self.dataModel.AnnualSilkwormFour);
                        self.dataModel.TecPersonAllInNum = self.dataModel.TecPersonAllInNum == null ? '' :self.$options.filters.integer(self.dataModel.TecPersonAllInNum);
                        self.dataModel.TecPersonTotalNum=self.dataModel.TecPersonTotalNum==null?'':self.$options.filters.integer(self.dataModel.TecPersonTotalNum);
                        self.dataModel.ManNum = self.dataModel.ManNum == null ? '' :self.$options.filters.integer(self.dataModel.ManNum);
                        self.dataModel.WomanNum = self.dataModel.WomanNum == null ? '' :self.$options.filters.integer(self.dataModel.WomanNum);
                        self.dataModel.AgeOne = self.dataModel.AgeOne == null ? '' :self.$options.filters.integer(self.dataModel.AgeOne);
                        self.dataModel.AgeTwo = self.dataModel.AgeTwo == null ? '' :self.$options.filters.integer(self.dataModel.AgeTwo);
                        self.dataModel.AgeThree = self.dataModel.AgeThree == null ? '' :self.$options.filters.integer(self.dataModel.AgeThree);
                        self.dataModel.AgeFour = self.dataModel.AgeFour == null ? '' :self.$options.filters.integer(self.dataModel.AgeFour);
                        self.dataModel.EduLevelOne = self.dataModel.EduLevelOne == null ? '' :self.$options.filters.integer(self.dataModel.EduLevelOne);
                        self.dataModel.EduLeveTwo = self.dataModel.EduLeveTwo == null ? '' :self.$options.filters.integer(self.dataModel.EduLeveTwo);
                        self.dataModel.EduLevelThree = self.dataModel.EduLevelThree == null ? '' :self.$options.filters.integer(self.dataModel.EduLevelThree);
                        self.dataModel.EduLevelFour = self.dataModel.EduLevelFour == null ? '' :self.$options.filters.integer(self.dataModel.EduLevelFour);
                        self.dataModel.TitleOne = self.dataModel.TitleOne == null ? '' :self.$options.filters.integer(self.dataModel.TitleOne);
                        self.dataModel.TitleTwo = self.dataModel.TitleTwo == null ? '' :self.$options.filters.integer(self.dataModel.TitleTwo);
                        self.dataModel.TitleThree = self.dataModel.TitleThree == null ? '' :self.$options.filters.integer(self.dataModel.TitleThree);
                        self.dataModel.TitleFour = self.dataModel.TitleFour == null ? '' :self.$options.filters.integer(self.dataModel.TitleFour);
                        self.dataModel.IncuRoomNum = self.dataModel.IncuRoomNum == null ? '' :self.$options.filters.integer(self.dataModel.IncuRoomNum);
                        self.dataModel.IncuRoomArea = self.dataModel.IncuRoomArea == null ? '' :self.$options.filters.integer(self.dataModel.IncuRoomArea);
                        self.dataModel.JiCuiqingPower = self.dataModel.JiCuiqingPower == null ? '' :self.$options.filters.integer(self.dataModel.JiCuiqingPower);
                        self.dataModel.YearsOfIncu = self.dataModel.YearsOfIncu == null ? '' :self.$options.filters.integer(self.dataModel.YearsOfIncu);
                        self.dataModel.SilkwormSpots = self.dataModel.SilkwormSpots == null ? '' :self.$options.filters.integer(self.dataModel.SilkwormSpots);
                        self.dataModel.SilkwormArea = self.dataModel.SilkwormArea == null ? '' :self.$options.filters.integer(self.dataModel.SilkwormArea);
                        self.dataModel.QuaternaryFertility = self.dataModel.QuaternaryFertility == null ? '' :self.$options.filters.integer(self.dataModel.QuaternaryFertility);
                        self.dataModel.AnnualTotalFertility =self.dataModel.AnnualTotalFertility == null ? '' : self.$options.filters.integer(self.dataModel.AnnualTotalFertility);
                        self.dataModel.LargeCocoonNum = self.dataModel.LargeCocoonNum == null ? '' :self.$options.filters.integer(self.dataModel.LargeCocoonNum);
                        self.dataModel.LargeCocoonArea = self.dataModel.LargeCocoonArea == null ? '' :self.$options.filters.integer(self.dataModel.LargeCocoonArea);
                        self.dataModel.LaborSavingRearTable = self.dataModel.LaborSavingRearTable == null ? '' :self.$options.filters.integer(self.dataModel.LaborSavingRearTable);
                        self.dataModel.GridCluster = self.dataModel.GridCluster == null ? '' :self.$options.filters.integer(self.dataModel.GridCluster);
                        self.dataModel.CocoonStation = self.dataModel.CocoonStation == null ? '' :self.$options.filters.integer(self.dataModel.CocoonStation);
                        self.dataModel.CocoonStationArea = self.dataModel.CocoonStationArea == null ? '' :self.$options.filters.integer(self.dataModel.CocoonStationArea);
                        self.dataModel.SeasonalDryCapacity = self.dataModel.SeasonalDryCapacity == null ? '' :self.$options.filters.integer(self.dataModel.SeasonalDryCapacity);
                        self.dataModel.CircularDryMachine = self.dataModel.CircularDryMachine == null ? '' :self.$options.filters.integer(self.dataModel.CircularDryMachine);
                        self.BtnSaveStatus = true;
                    } else {
                        self.dataModel = res.data.list.model;
                        self.$Modal.warning({
                            title: "提示信息",
                            content: res.data.list.message
                        });
                        self.BtnSaveStatus = false;
                    }
                }
            );
        },
        checkEmpty(value){
          if(value != null&& value!=""&&value!=" "){
              return true;
          }else{
              return false;
          }
        },
        //保存方法
        save(name) {
            var self = this;
            self.$refs[name].validate((valid) => {
              if (valid) {
                if(Number(self.dataModel.TecPersonTotalNum)<Number(self.dataModel.TecPersonAllInNum)){
                  self.$Modal.warning({
                      title: "提示信息",
                      content: "其中：在职在编人数应小于技术人员总数!"
                  });
                }else if(Number(self.dataModel.TecPersonTotalNum)!=(Number(self.dataModel.ManNum)+Number(self.dataModel.WomanNum))){
                  self.$Modal.warning({
                      title: "提示信息",
                      content: "男+女的人数应等于技术人员总数!"
                  });
                }else if(Number(self.dataModel.TecPersonTotalNum)!=(Number(self.dataModel.AgeOne)+Number(self.dataModel.AgeTwo)+Number(self.dataModel.AgeThree)+Number(self.dataModel.AgeFour))){
                  self.$Modal.warning({
                      title: "提示信息",
                      content: "按年龄分的人数之和应等于技术人员总数!"
                  });
                }else if(Number(self.dataModel.TecPersonTotalNum)!=(Number(self.dataModel.EduLevelOne)+Number(self.dataModel.EduLeveTwo)+Number(self.dataModel.EduLevelThree)+Number(self.dataModel.EduLevelFour))){
                  self.$Modal.warning({
                      title: "提示信息",
                      content: "按学历层次分的人数之和应等于技术人员总数!"
                  });
                }else if(Number(self.dataModel.TecPersonTotalNum)!=(Number(self.dataModel.TitleOne)+Number(self.dataModel.TitleTwo)+Number(self.dataModel.TitleThree)+Number(self.dataModel.TitleFour))){
                  self.$Modal.warning({
                      title: "提示信息",
                      content: "按职称情况分的人数之和应等于技术人员总数!"
                  });
                }
                else{
                  this.$http.put('MulProdInfoChart', self.dataModel).then(
                  function(res) {
                      if (res.data.status == 1) {
                          self.GetData();
                          self.$Notice.success({
                              title: '数据保存成功！',
                              desc: false
                          });
                      } else {
                          self.$Modal.warning({
                              title: "提示信息",
                              content: "更新失败,请与管理员联系!"
                          });
                      }
                  });
                }
              }
            else
            {
                this.$Notice.error({
                  title: '数据验证出错,请根据提示操作后再试!',
                  desc: '',
                });
            }
          });
        },
        //数据上报
        DataUp() {
            var self = this;
            self.$Modal.confirm({
                title: '提示信息',
                content: '<p>数据上报后，不能再更改，是否继续上报？</p>',
                onOk: () => {
                    var model = new Object();
                    model.Id = self.dataModel.ReportId;
                    model.reportType = '3';
                    model.strMsg = '';
                    this.$http.post("Report/PostUpStatus", model).then(
                        function (res) {
                            if (res.data.status == 1) {
                                self.$Notice.success({ title: '数据上报成功！', desc: false });
                                self.GetData();
                            }
                            else {
                                self.$Modal.error({ title: "提示信息", content: "数据上报失败!" });
                            }
                        }
                    );
                }
            });
        },
        //导入
        GetPostUrl(){
           var url= this.$http.defaults.baseURL + "Report/PostImportData?FillInYear="+this.searchModel.FillInYear+"&&ReportCode="+this.searchModel.ReportCode+"&&AreaCode="+this.searchModel.AreaCode;
           return url;
        },
        handleSuccess(res, file) {
            var self = this;
            self.GetData();
            self.$Notice.success({
                title: '数据导入成功！',
                desc: false
            });
        },
        //导出
        ExcelDown:function(){
            var self = this;
            var model = new Object();
            model.ReportCode = self.searchModel.ReportCode;
            if (self.searchModel.FillInYear != null && self.searchModel.FillInYear != '') {
                model.FillInYear = self.searchModel.FillInYear;
            } else {
                model.FillInYear = self.CurrentYear + '年';//填报年度-----数据字典值
                self.searchModel.FillInYear = self.CurrentYear + '年';
            }
            model.AreaCode = self.searchModel.AreaCode;
            window.open(this.$http.defaults.baseURL + "MulProdInfoChart/GetExcelData?ReportCode=" + model.ReportCode+"&&FillInYear="+model.FillInYear+"&&AreaCode="+model.AreaCode);
        },
        //模板下载
        TmpDown: function () {
            window.open(this.$http.defaults.baseURL + "Report/GetTemplateData?ReportCode=" + this.searchModel.ReportCode);
        },
      },
      computed:{
        // TecPersonTotalNum:{
        //     get:function(){
        //         var ManNum = this.dataModel.ManNum == null ? '' : Number(this.dataModel.ManNum);
        //         var WomanNum = this.dataModel.WomanNum == null ? '' : Number(this.dataModel.WomanNum);
        //         var AgeOne = this.dataModel.AgeOne == null ? '' : Number(this.dataModel.AgeOne);
        //         var AgeTwo = this.dataModel.AgeTwo == null ? '' : Number(this.dataModel.AgeTwo);
        //         var AgeThree = this.dataModel.AgeThree == null ? '' : Number(this.dataModel.AgeThree);
        //         var AgeFour = this.dataModel.AgeFour == null ? '' : Number(this.dataModel.AgeFour);
        //         var EduLevelOne = this.dataModel.EduLevelOne == null ? '' : Number(this.dataModel.EduLevelOne);
        //         var EduLeveTwo = this.dataModel.EduLeveTwo == null ? '' : Number(this.dataModel.EduLeveTwo);
        //         var EduLevelThree = this.dataModel.EduLevelThree == null ? '' : Number(this.dataModel.EduLevelThree);
        //         var EduLevelFour = this.dataModel.EduLevelFour == null ? '' : Number(this.dataModel.EduLevelFour);
        //         var TitleOne = this.dataModel.TitleOne == null ? '' : Number(this.dataModel.TitleOne);
        //         var TitleTwo = this.dataModel.TitleTwo == null ? '' : Number(this.dataModel.TitleTwo);
        //         var TitleThree = this.dataModel.TitleThree == null ? '' : Number(this.dataModel.TitleThree);
        //         var TitleFour = this.dataModel.TitleFour == null ? '' : Number(this.dataModel.TitleFour);
        //         if((ManNum+WomanNum)==(AgeOne+AgeTwo+AgeThree+AgeFour)&&
        //         (ManNum+WomanNum)==(EduLevelOne+EduLeveTwo+EduLevelThree+EduLevelFour)&&
        //         (ManNum+WomanNum)==(TitleOne+TitleTwo+TitleThree+TitleFour)){
        //           var TecPersonTotalNum = ManNum+WomanNum;
        //         }
        //         return TecPersonTotalNum;
        //     }
        // }
      },
      //创建Vue页面方法
      created: function () {
        //创业Vue前调用获取this.datas: {},//table数据对象
        this.GetData();
      },
      watch: {
        //需要监听的在此处新增监听对象
      }
    }

  </script>
